package com.ganbo.ms.nio;

import java.nio.IntBuffer;

/**
 * @author ganbo
 * @date 2022/11/13 18:18
 */
public class BufferTest {

    public static void main(String[] args) {
        IntBuffer intBuffer = IntBuffer.allocate(5);

        for (int i = 0; i < 5; i++) {
            intBuffer.put(i);
        }

        intBuffer.flip();
        while (intBuffer.hasRemaining()) {
            System.out.println(intBuffer.get());
        }

        System.out.println(intBuffer.capacity());
//        intBuffer.put(1);
    }
}
